#include "stdafx.h"

WorldLog*		g_pLOG = NULL;
CSunLog*		g_pWorldLog = NULL;
CSunLog*		g_pCountLog = NULL;

bool MessageOut(BYTE byLogLevel, char *szMsg,...)
{
	char strBuffer[1024]; 

    va_list args; 
    va_start(args, szMsg); 
    _vsnprintf( strBuffer, 1024, szMsg, args ); 
    va_end(args); 

	if(g_pWorldLog)
	{
		return g_pWorldLog->InsertMessage( strBuffer, byLogLevel );
	}
	else
	{
		printf("%s\n", strBuffer);
	}

	return TRUE;
}

bool MessageCount(BYTE byLogLevel, char *szMsg,...)
{
	char strBuffer[1024];

    va_list args; 
    va_start(args, szMsg); 
    _vsnprintf( strBuffer, 1024, szMsg, args ); 
    va_end(args); 

	if(g_pCountLog)
	{
		return g_pCountLog->InsertMessage( strBuffer, byLogLevel );
	}
	else
	{
		printf("%s\n", strBuffer);
	}

	return TRUE;
}
